/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.model.events;

import java.util.Map;

/**
 * This is a subclass of XREEvent that represents the "onGetComplete" event.
 * <p>
 * <b>Thread safety:</b> This class is mutable and not thread safe.
 * <p>
 * AndroidAssembly3 this class was added at Android Assembly 3.
 *
 * @author TCSASSEMBLER
 * @version 1.0
 */
public class XREGetCompleteEvent extends XREResourceEvent {
    /**
     * Represents the name of the "on get complete" event.
     * <p>
     * This is a string constant used by the user when setting the name of the event.
     */
    public static final String ON_GET_COMPLETE_EVENT_NAME = "onGetComplete";

    /**
     * Represents the name used to retrieve the context parameter.</p>
     */
    private static final String CONTEXT = "context";

    /**
     * Represents the name used to retrieve the properties parameter.</p>
     */
    private static final String PROPS = "props";

    /**
     * Creates new instance of {@link XREGetCompleteEvent} class.
     */
    public XREGetCompleteEvent() {
        // empty constructor
    }

    /**
     * Retrieves the context parameter of GET command.
     *
     * @return the context parameter of GET command
     * @throws IllegalStateException if the requested parameter has wrong type in the parameters map or params is null
     */
    public String getContext() {
        return getTypedParam(CONTEXT, String.class);
    }

    /**
     * Sets the context parameter of GET command.
     *
     * @param context the context parameter of GET command
     * @throws IllegalStateException if params is null
     */
    public void setContext(String context) {
        setParam(CONTEXT, context);
    }

    /**
     * Retrieves the map containing the fetched property values.
     *
     * @return the map containing the fetched property values
     * @throws IllegalStateException if the requested parameter has wrong type in the parameters map or if params is
     * null
     */
    @SuppressWarnings("unchecked")
    public Map<String, Object> getProps() {
        return getTypedParam(PROPS, Map.class);
    }

    /**
     * Sets the map containing the fetched property values.
     *
     * @param props the map containing the fetched property values.
     * @throws IllegalStateException if params is null
     */
    public void setProps(Map<String, Object> props) {
        setParam(PROPS, props);
    }
}
